#include <stdio.h>
#include <stdlib.h>
using namespace std;

typedef struct vex {
	//int index;
	int next[20];
	int count;
} vex;

int main() {
	int n;
	while (scanf("%d", &n) != EOF) {
		vex vnode[n];
		for (int i = 0; i < n; i++) {
			int tail, head;
			scanf("%d %d", &tail, &head);
			vnode[tail + 1].next[count] = head + 1;
			vnode[tail + 1].count++;

			vnode[head + 1].next[count] = tail + 1;
			vnode[head + 1].cout++;


		}
	}

	return 0;
}